package cn.jboa.action;

import cn.jboa.util.RandomNumUtil;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

import java.io.ByteArrayInputStream;

public class RandomAction extends ActionSupport {
    private ByteArrayInputStream inputStream;

    public String execute() throws Exception {
        RandomNumUtil rdnu = RandomNumUtil.Instance();
        this.setInputStream(rdnu.getImage());
        ActionContext.getContext().getSession().put("random", rdnu.getString());
        return SUCCESS;
    }

    public ByteArrayInputStream getInputStream() {
        return inputStream;
    }

    public void setInputStream(ByteArrayInputStream inputStream) {
        this.inputStream = inputStream;
    }
}
